home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
programming
/
c
/
pmm
/
doku
/
thirdpartytools
/
fd2libwos.doc
< prev
next >
Wrap
Text File
|
1999-06-14
|
5KB
|
144 lines
fd2libWOS by Frank Wille / Volker Barthelmann / Johnny Tevessen
INTRODUCTION
fd2libWOS takes .fd-files as input and generates assembler source to
create a library with stubs to call the functions (including stubs
for varargs functions).
LEGAL
fd2libWOS is public domain.
USAGE
Usage : fd2libWOS [-sd] [-l] [-r2] [-nv] [-base <name>] [-o <dir>]
[-of <format>] [-d] [-?|--help] [files/pattern]
-sd : Use small data model (else large data model)
Not yet supported.
-l : First argument (r3) is library base
-r2 : PPC-only library uses r2 as base register (##abi PPC2)
-nv : No varargs logic - ...A and ...TagList will not be detected
-base: Overwrites library base name (##base)
-o : Specify directory to store source files in
-of : C printf style output format to generate compiling
script. Three `%s' are replaced with output file name
-d : Turn on debugging/verbose mode
-? : Show help/version and quit
files : FD files to convert, defaults to stdin
Commandline is parsed left-to-right. So specifying
> fd2libwos alib_lib.fd -sd blib_lib.fd
will result in alib created using large data model.
There may also be a -prof option in future, but it's not yet
implemented.
fd2libwos will process all the .fd-files specified at the command line
(not specifying any filename results in fd2libwos using stdin (console)
as input) and will generate an assembler source for each library
function as functionname.s and a file containing all the library
vector offsets as libname_lvo.s.
Files are placed in the current directory. Specify an alternative
destination using the `-o <dir>' option.
GENERATED CODE
fd2libWOS creates code to be assembled with Frank Wille's pasm (use
option -F2 for EHF). The generated stubs are compatible with H&P's
PowerOpen-ABI. vlink is recommended for linking the stubs, because
the "@_xxx" symbols have to be created on demand.
VARARGS
Some functions take a pointer to a list of arguments as the last
argument. fd2libwos has a hardcoded list of such function and creates
additional stubs that can be called with a variable number of arguments
from C (e.g. OpenWindowTagList and OpenWindowTags).
If you want to extend this list, you have to add the name of the
function and the name of the varargs function to the file vargs.h
and recompile fd2libwos.
Fd2libwos also tries to recognize functions that might have varargs
automatically. It scans for `TagList' and `A' postfixes and sub-
stitutes them with `Tags' or `'. `A's are only suggested to be varargs
if the letter right before is lowercase.
You may turn off automatic recognition by specifying `-nv'.
GOODIES
`-of <string>' allows you to get runtime output. You may use this
feature to show fd2libwos's progress or to create batch files for post-
processing fd2libwos's output. `%s' is substituted by the output asm file
just processed. E.g.:
> fd2libWOS -of "pasm -F2 %s" fd:dos_lib.fd >batchfile
> execute batchfile
will process dos' functions and then compile them straight-forward.
You may use `%s' upto three times in the format string. C like jokes
like `%30s' to show the file's name right-aligned are also allowed.
CREATING LIBRARIES
If you want to create a library from some .fd-files proceed like this:
> delete T:#?.(s|o) quiet
> fd2libWOS -o T: <all the .fd-files you want>
(copying pasm to ram: now may speed up the process)
> vc +warpos -c T:#?.s
> join as <name of resulting lib> T:#?.o
> delete T:#?.(s|o)
MakeALIB.script
This is a small but smart script which will create an amiga.lib
in T:. It will delete files from T: before and assumes nothing is
written to T: while it is running.
You have to assign FD: to a directory that contains the .fd-files for
the Amiga shared libraries and cd into the libsrc/AmigaLib directory
and start it from there. Otherwise you will get an error.
It will then create all library stubs and LVOs with fd2libWOS (this
will result in many many small files in T: which will be assembled by
pasm - so having pasm in RAM: will speed it up quite a lot).
Then the support routines in libsrc/AmigaLib will be compiled/assembled
and the resulting object files will be put in T:, too. You must have
the C= includes.
The support routines are taken from libnix and have been changed a bit
to work with vbcc. I have not tested them and several support routines
from the original amiga.lib are missing.
The whole process may take quite some time and a few MB space in T:
The resulting amiga.lib should be free from any copyright and is a
rather good (but not complete) replacement for the original amiga.lib.
If everything went right you will be asked whether you want to have the
library installed to vlibwos:. Type <y> or do so manually if you don't
trust my script. :-)
Frank Wille frank@phoenix.owl.de
Volker Barthelmann volker@vb.franken.de
Johnny Tevessen j.tevessen@line.org